package com.jetinno.jetinnosystemclient;

import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.text.TextUtils;

/**
 * Created by zhangyuncai.
 * Date: 2022/11/8
 */
public class ClientReceiver extends BroadcastReceiver {
    @Override
    public void onReceive(Context context, Intent intent) {
        String action = intent.getAction();
        if (TextUtils.equals(action, ClientConstant.JETINNO_COFFEE_HB_ACTION)) {//APP定时器
            long aLong = intent.getLongExtra(ClientConstant.JETINNO_COFFEE_HB_ALONG, 0);
            ClientTimer.getInstance().receiveAppTimer(aLong);
        } else if (TextUtils.equals(action, ClientConstant.JETINNO_SYSTEM_HB_ACTION)) {//看门狗定时器
            dogHbAction(context, intent);
        }
    }

    private void dogHbAction(Context context, Intent intent) {
        int installedJetinnoSystemVersionCode = intent.getIntExtra(ClientConstant.JETINNO_SYSTEM_VERSION_CODE, 0);
        ClientTimer.getInstance().receiveDogTimer(installedJetinnoSystemVersionCode);
    }
}
